package com.sxz.sbs.module.client.presenter;

import com.sxz.sbs.app.App;
import com.sxz.sbs.module.client.bean.IntentionStallBean;
import com.sxz.sbs.module.client.view.AddCarView;
import com.sxz.sbs.module.client.view.IntentionStallView;
import com.sxz.sbs.rx.RxPresenter;
import com.sxz.sbs.rx.RxSubscriber;
import com.sxz.sbs.rx.RxUtil;

import java.util.HashMap;
import java.util.List;

/**
 * 意向车位
 * @author hp
 */
public class IntentionStallPresenter extends RxPresenter<IntentionStallView>{
    /**
     * @param map
     * 获取列表
     */
    public void getIntentionStall (final HashMap<String,Object> map) {
        addSubscribe(App.getInstance().getApi().getIntentionStall(map)
                .compose(RxUtil.<List<IntentionStallBean>>handleResult())
                .subscribeWith(new RxSubscriber<List<IntentionStallBean>>(mView,true){
                    @Override
                    public void onNext(List<IntentionStallBean> data) {
                        mView.onIntentionStallSuccess(data);
                    }
                })
        );
    }
    public void getCancelIntentionStall (final HashMap<String,Object> map) {
        addSubscribe(App.getInstance().getApi().getCancelIntentionStall(map)
                .compose(RxUtil.<String>handleResult())
                .subscribeWith(new RxSubscriber<String>(mView,true){
                    @Override
                    public void onNext(String data) {
                        mView.onCancelIntentionStallSuccess(data);
                    }
                })
        );
    }
}
